package rhc.spider.engineExecuter;

import rhc.spider.common.SpiderData;
import rhc.spider.crawler.Crawler;
import rhc.spider.engine.Engine;
import rhc.spider.middlewareManage.impl.DownloadMiddlewareManage;
import rhc.spider.middlewareManage.impl.ExtensionMiddlewareManage;
import rhc.spider.middlewareManage.impl.SpiderMiddlewareManage;
import rhc.spider.request.Request;
import rhc.spider.request.Response;
import rhc.spider.setting.Setting;
import rhc.spider.spider.Spider;

abstract public class BasicEngineExecuter implements EngineExecuter{

	private Crawler crawler;
	
	private Setting setting;
	
	public BasicEngineExecuter(Crawler crawler,Setting setting){
		this.crawler=crawler;
		this.setting=setting;
	}
	
	@Override
	public void executeRequest(Request request){
		
		
		
	}
	
	@Override
	public void executeSpiderData(Spider spider,Request request,Response response,SpiderData data){
		
	}
	
	@Override
	public void spiderInput(Response response){
		crawler.getSpider().parseResponse(response);
	}
	
	@Override
	public void spiderOutput(SpiderData data){
		
	}
	
	private void executeDownloadMiddle(Request request){
		
		DownloadMiddlewareManage dmm=crawler.getDownloadMiddlewareManage();
		
		dmm.processRequest(crawler.getSpider(), request);
		
	}
}
